package com.tarena.lbs.coupon.enums;

import lombok.Getter;

/**
 * @className: CouponEnableStatus
 * @author: Feng-hongliang
 * @date: 2025/10/11 11:06
 * @Version: 1.0
 * @description:
 */
@Getter
public enum CouponEnableStatus {
    /**
     * 未启用
     */
    DISABLED(0, "未启用"),

    /**
     * 已启用
     */
    ENABLED(1, "已启用");

    private final Integer code;
    private final String description;

    CouponEnableStatus(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public Integer getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static CouponEnableStatus fromCode(Integer code) {
        for (CouponEnableStatus status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown enable status code: " + code);
    }
}

